package com.alan.libapi.api;


import com.alan.libapi.model.persistent.ErrorInfo;

/**
 * 响应数据体
 * @author JajuanWang
 * @date 2015-08-30 17:56
 * @param <T> 数据类型
 * @version V1.0
 */
public class ApiResponse<T> {

	/**
	 * 成功返回码
	 */
	public static final int SUCCESS_CODE = 1;
	/**
	 * 默认的错误返回码
	 */
	public static final int DEFAULT_ERROR_CODE = 0;

	/**
	 * 返回码
	 */
	private int retCode;
	
	private ErrorInfo errorResponse;
	
	/**
	 * 返回数据
	 */
	private T result;

	public int getRetCode() {
		return retCode;
	}

	public void setRetCode(int retCode) {
		this.retCode = retCode;
	}

	public T getResult() {
		return result;
	}

	public void setResult(T result) {
		this.result = result;
	}

	public ErrorInfo getErrorResponse() {
		return errorResponse;
	}

	public void setErrorResponse(ErrorInfo errorResponse) {
		this.errorResponse = errorResponse;
	}

	@Override
	public String toString() {
		return "ApiResponse{" +
				"retCode=" + retCode +
				", errorResponse=" + errorResponse +
				", result=" + result +
				'}';
	}
}
